//package function;
//
//public class FunDemo01 {
////    public static void main(String[] args) {
////        ParamTest pt = new ParamTest();
////        User hollis = new User();
////        hollis.setName("Hollis");
////        hollis.setGender("Male");
////        pt.pass(hollis);
////        System.out.println("print in main , user is " + hollis);
////    }
////
////    public void pass(User user) {
////        user.setName("hollischuang");
////        System.out.println("print in pass , user is " + user);
////    }
//    public static void main(String[] args) {
//        Student st1 = new Stundent();
//        Student st2 = st1;
//        st2.setName(" ");
//        System.out.println();
//    }
//}
//
//class Student {
//    String name;
//    Student(){
//
//    }
//    public void setName(String name){
//        this.name = name;
//    }
//}

package function;

public class FunDemo01 {
    public static void main(String[] args) {
        //输出Hello World。new对象一建立，就会调用对应的构造函数Confun()，并执行其中的println语句。
        Confun c1=new Confun();
        Confun c2 = c1;  //c1,c2指向同一地址
        c2.setName("123");
        System.out.println(c2.name);
        System.out.println(c1.name);
    }
}
class Confun{
    public String name;

    Confun(){
        //定义构造函数，输出Hello World
        System.out.println("Hellow World");
    }

    public void setName(String s) {
        this.name = s;
    }
}